import 'package:basic_library/basic_library.dart';
import 'package:flutter/material.dart';

///
/// 中心文字底部线
///
class TextCenterBottomLineCell extends StatelessWidget {
  final bool isCancel;
  final String title;
  final bool isSelect; // 是否被选中
  final GestureTapCallback? tapCallback;

  const TextCenterBottomLineCell({
    Key? key,
    required this.title,
    this.isCancel = false,
    this.isSelect = false,
    this.tapCallback,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (tapCallback != null) {
          tapCallback!();
        }
      },
      child: Container(
        decoration: const BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(6), topRight: Radius.circular(6))),
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 20),
              child: isCancel
                  ? Text(
                      title,
                      style: const TextStyle(
                        fontWeight: FontWeight.w800,
                        fontSize: 18,
                        color: Color(0xFF41485D),
                      ),
                    )
                  : Text(
                      title,
                      style: TextStyle(
                        fontSize: 16,
                        color: isSelect ? Colors.lightBlue : const Color(0xFF41485D),
                      ),
                    ),
            ),
            isCancel ? Container() : const LineCell()
          ],
        ),
      ),
    );
  }
}
